#ifndef SPARSE_MATRIX_INCLUDE
#define SPARSE_MATRIX_INCLUDE

enum sortFlag{byRow,byCol};

struct sparseMatrix_t {
	double *data;
	int *row;
	int *col;
	int numRows;
	int numCols;
	int numElements;
	int *index;
	sparseMatrix_t *onDevice;

	void printMatrix(sortFlag s);
	void bubbleSort(int, int, sortFlag flag);
	void swap( int , int);
	void qsort(int low, int high, sortFlag flag);
	int comparator(int,int,sortFlag);
	void testSort(sortFlag flag);
	int nextIndex(int curIndex, sortFlag flag);
	void buildIndex(sortFlag flag);
	void allocateData(int numRows, int numCols, int numElements);
	void allocateDataGPU(int numRows, int numCols, int numElements);
	sparseMatrix_t* copyMatrixToGPU(int numRows, int numCols, int numElements);
	void copyDataToGPU(sparseMatrix_t onDevice);
	sparseMatrix_t* transferMatrixToGPU();
	void copyDataToCPU(sparseMatrix_t onDevice);
	void sort(sortFlag flag);
	void deallocate();
	void deallocateGPU();
};

#endif